package com.foreknow.service.impl;

import com.foreknow.mapper.UserMapper;
import com.foreknow.entity.User;
import com.foreknow.service.UserServie;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServieImpl implements UserServie {

    @Autowired
    private UserMapper userMapper;

    /**
     * 登录
     * @param userName
     * @param password
     * @return
     */
    @Override
    public User login(String userName, String password) {
        return userMapper.login(userName,password);
    }

    /**
     * 获取用户列表
     * @param deptId
     * @param registLeId
     * @return
     */
    @Override
    public List<User> getUserList(Integer deptCategoryId,Integer deptId, Integer registLeId,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<User> list = userMapper.getUserList(deptCategoryId,deptId,registLeId);
        return list;
    }
}
